﻿<phone:PhoneApplicationPage 
	xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
	xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
	xmlns:phone="clr-namespace:Microsoft.Phone.Controls;assembly=Microsoft.Phone"
	xmlns:controls="clr-namespace:Microsoft.Phone.Controls;assembly=Microsoft.Phone.Controls"
	xmlns:shell="clr-namespace:Microsoft.Phone.Shell;assembly=Microsoft.Phone"
	xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
	xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
	xmlns:controlsPrimitives="clr-namespace:Microsoft.Phone.Controls.Primitives;assembly=Microsoft.Phone.Controls"
	mc:Ignorable="d" d:DesignWidth="480" d:DesignHeight="728"
	x:Class="PhoneInfo.PivotPage1"
	SupportedOrientations="Portrait" Orientation="Portrait"
	shell:SystemTray.IsVisible="False"
    xmlns:delay="clr-namespace:Delay;assembly=PhonePerformance"
    xmlns:local="clr-namespace:PhoneInfo" Style="{StaticResource TransitionPageStyle}"
    xmlns:toolkit="clr-namespace:Microsoft.Phone.Controls;assembly=Microsoft.Phone.Controls.Toolkit"
    >
	<phone:PhoneApplicationPage.Resources>
        <local:FixEmptyUrl x:Key="FixUrl"/>
        <shell:ApplicationBar x:Key="AppBar" ForegroundColor="#ffffffff"  BackgroundColor="#0a76d2">
            <shell:ApplicationBarIconButton IconUri="Icon/info/i_forum.png" Text="发表评论" Click="Reply"/>
            <shell:ApplicationBarIconButton IconUri="Icon/info/i_refresh.png" Text="刷新" Click="refresh" />
        </shell:ApplicationBar>
        <shell:ApplicationBar x:Key="AppBarSavePic"  BackgroundColor="#0a76d2" ForegroundColor="#ffffffff">
            <shell:ApplicationBarIconButton IconUri="Icon/info/i_yes.png" Text="保存图片" Click="save"/>
            <shell:ApplicationBarIconButton IconUri="Icon/info/i_cancel.png" Text="取消" Click="ApplicationBarIconButton_Click"/>
        </shell:ApplicationBar>
        <shell:ApplicationBar x:Key="AppBarContent"  BackgroundColor="#0a76d2" ForegroundColor="#ffffffff">
            <shell:ApplicationBarIconButton IconUri="Icon/info/i_forum.png" Text="评论" Click="Reply"/>
            <shell:ApplicationBarIconButton IconUri="Icon/info/i_favorites.png" Text="收藏"  Click="Shard"/>
            <shell:ApplicationBarIconButton IconUri="Icon/info/i_refresh.png" Text="刷新" Click="refresh" />
            <shell:ApplicationBar.MenuItems>
                <shell:ApplicationBarMenuItem   Text="设置" Click="setting" />
                <shell:ApplicationBarMenuItem   Text="留言板" Click="messageBoard" />
                <shell:ApplicationBarMenuItem   Text="关于" Click="about" />
            </shell:ApplicationBar.MenuItems>
        </shell:ApplicationBar>
        <shell:ApplicationBar x:Key="AppBar1" ForegroundColor="#ffffffff"  BackgroundColor="#212121">
            <shell:ApplicationBarIconButton IconUri="Icon/black/i_forum.png" Text="发表评论" Click="Reply"/>
            <shell:ApplicationBarIconButton IconUri="Icon/black/i_refresh.png" Text="刷新" Click="refresh" />
        </shell:ApplicationBar>
        <shell:ApplicationBar x:Key="AppBarSavePic1"  BackgroundColor="#212121" ForegroundColor="#ffffffff">
            <shell:ApplicationBarIconButton IconUri="Icon/black/i_yes.png" Text="保存图片" Click="save"/>
            <shell:ApplicationBarIconButton IconUri="Icon/black/i_cancel.png" Text="取消" Click="ApplicationBarIconButton_Click"/>
        </shell:ApplicationBar>
        <shell:ApplicationBar x:Key="AppBarContent1"  BackgroundColor="#212121" ForegroundColor="#ffffffff">
            <shell:ApplicationBarIconButton IconUri="Icon/black/i_forum.png" Text="评论" Click="Reply"/>
            <shell:ApplicationBarIconButton IconUri="Icon/black/i_favorites.png" Text="收藏"  Click="Shard"/>
            <shell:ApplicationBarIconButton IconUri="Icon/black/i_refresh.png" Text="刷新" Click="refresh" />
            <shell:ApplicationBar.MenuItems>
                <shell:ApplicationBarMenuItem   Text="设置" Click="setting" />
                <shell:ApplicationBarMenuItem   Text="留言板" Click="messageBoard" />
                <shell:ApplicationBarMenuItem   Text="关于" Click="about" />
            </shell:ApplicationBar.MenuItems>
        </shell:ApplicationBar>
        <Style x:Key="PivotStyle1" TargetType="controls:Pivot">
			<Setter Property="Margin" Value="0"/>
			<Setter Property="Padding" Value="0"/>
			<Setter Property="Foreground" Value="{StaticResource PhoneForegroundBrush}"/>
			<Setter Property="Background" Value="Transparent"/>
			<Setter Property="ItemsPanel">
				<Setter.Value>
					<ItemsPanelTemplate>
						<Grid/>
					</ItemsPanelTemplate>
				</Setter.Value>
			</Setter>
			<Setter Property="Template">
				<Setter.Value>
					<ControlTemplate TargetType="controls:Pivot">
						<Grid HorizontalAlignment="{TemplateBinding HorizontalAlignment}" VerticalAlignment="{TemplateBinding VerticalAlignment}">
							<Grid.RowDefinitions>
								<RowDefinition Height="Auto"/>
								<RowDefinition Height="Auto"/>
								<RowDefinition Height="*"/>
							</Grid.RowDefinitions>
							<Grid Background="{TemplateBinding Background}" CacheMode="BitmapCache" Grid.RowSpan="3"/>
							<controlsPrimitives:PivotHeadersControl x:Name="HeadersListElement" Grid.Row="1"/>
							<ItemsPresenter x:Name="PivotItemPresenter" Margin="{TemplateBinding Padding}" Grid.Row="2"/>
						</Grid>
					</ControlTemplate>
				</Setter.Value>
			</Setter>
		</Style>
        <Style x:Key="ListBoxStyle1" TargetType="ListBox">
        	<Setter Property="Background" Value="Transparent"/>
        	<Setter Property="Foreground" Value="{StaticResource PhoneForegroundBrush}"/>
        	<Setter Property="ScrollViewer.HorizontalScrollBarVisibility" Value="Disabled"/>
        	<Setter Property="ScrollViewer.VerticalScrollBarVisibility" Value="Auto"/>
        	<Setter Property="BorderThickness" Value="0"/>
        	<Setter Property="BorderBrush" Value="Transparent"/>
        	<Setter Property="Padding" Value="0"/>
        	<Setter Property="Template">
        		<Setter.Value>
        			<ControlTemplate TargetType="ListBox">
        				<ScrollViewer x:Name="ScrollViewer" BorderBrush="{TemplateBinding BorderBrush}" BorderThickness="{TemplateBinding BorderThickness}" Background="{TemplateBinding Background}" Foreground="{TemplateBinding Foreground}" Padding="{TemplateBinding Padding}">
                            <ItemsPresenter/>
                        </ScrollViewer>
        			</ControlTemplate>
        		</Setter.Value>
        	</Setter>
        </Style>
	</phone:PhoneApplicationPage.Resources>
	<phone:PhoneApplicationPage.FontFamily>
		<StaticResource ResourceKey="PhoneFontFamilyNormal"/>
	</phone:PhoneApplicationPage.FontFamily>
	<phone:PhoneApplicationPage.FontSize>
		<StaticResource ResourceKey="PhoneFontSizeNormal"/>
	</phone:PhoneApplicationPage.FontSize>
	<phone:PhoneApplicationPage.Foreground>
		<StaticResource ResourceKey="PhoneForegroundBrush"/>
	</phone:PhoneApplicationPage.Foreground>
	<!--LayoutRoot 是放置所有页面内容的根网格-->
    <Grid x:Name="LayoutRoot" Background="{Binding Source={StaticResource Theme}, Path=cuTheme.TextBrush}" Margin="0,0,0,-2">
		<!--透视控件-->
        <toolkit:PerformanceProgressBar   Foreground="Orange" x:Name="ProgBar" Canvas.Top="0" Canvas.Left="0" Visibility="Visible"  IsIndeterminate="True" Height="10" HorizontalAlignment="Left" VerticalAlignment="Top" Margin="0"  Width="480" />
        <controls:Pivot x:Name="PivotInfo"  Title="MY APPLICATION" Style="{StaticResource PivotStyle1}" Margin="0,8,0,0" SelectionChanged="Pivot_SelectionChanged">
			<!--透视项目一-->
            <controls:PivotItem  x:Name="phoneContent"  Margin="12,0,0,0">
				<controls:PivotItem.Header>
				  <StackPanel Orientation="Horizontal" >
                        <TextBlock Text="内容"   Foreground="{Binding Source={StaticResource Theme}, Path=cuTheme.TitleBrush}"  FontSize="50"  VerticalAlignment="Center" />
                     <Image Margin="10,10,0,0"  Source="/Icon/info/a_comment.png" Height="25" Width="25" RenderTransformOrigin="0.35,0.55"/>
                        <TextBlock x:Name="readCount"   Margin="10,0,0,0" FontSize="18"
                                   Foreground="#b5b5b5"
                                   VerticalAlignment="Center"/>
                  </StackPanel>
				 </controls:PivotItem.Header>
                <Grid>
                    <ListBox x:Name="FirstListBox"  Loaded="FirstListBox_Loaded" ItemsSource="{Binding PoneConterItems}" Tap="FirstListBox_Tap" Style="{StaticResource ListBoxStyle1}">
                        <ListBox.ItemsPanel>
                            <ItemsPanelTemplate>
                                <StackPanel></StackPanel> 
                            </ItemsPanelTemplate> 
                        </ListBox.ItemsPanel>
                        <ListBox.ItemTemplate>
                            <DataTemplate>
                                <delay:FoodTemplateSelector x:Name="foodTemplateSelector" Content="{Binding}" >                                   
                                    <delay:FoodTemplateSelector.Head>
                                        <DataTemplate>
                                            <Grid  Width="480" Height="270"  HorizontalAlignment="Center" VerticalAlignment="Center">
                                                <Image  HorizontalAlignment="Center" Margin="0,10"  
                                                        delay:LowProfileImageLoader.UriSource="{Binding Picurl, Converter={StaticResource FixUrl}}" 
                                                        Stretch="UniformToFill" />
                                            </Grid>
                                        </DataTemplate>
                                    </delay:FoodTemplateSelector.Head>
                                    <delay:FoodTemplateSelector.Main>
                                        <DataTemplate>
                                            <Grid Margin="0,0,15,0" Grid.Column="0">
                                                 <local:LexunContentBox Content="{Binding Content}" TextWrapping="Wrap" Width="446" Margin="5"
                                                             TextAlignment="Justify"    />
                                                <!--<RichTextBox  delay:SuperUrlConver.TextSource="{Binding Content}" TextWrapping="Wrap" Width="446" Margin="5"
                                                             TextAlignment="Justify" />-->
                                            </Grid>
                                           
                                        </DataTemplate>
                                    </delay:FoodTemplateSelector.Main>
                                    <delay:FoodTemplateSelector.Tail>
                                        <DataTemplate>
                                             <StackPanel Margin="0,0,0,0"  Width="468"  Orientation="Horizontal">
                                                <Ellipse Width="18" Height="18" Margin="0"
                                                  Stroke="#00ffffff"
                                                  StrokeThickness="1">
                                                    <Ellipse.Fill>
                                                        <SolidColorBrush Color="#31b2e7"/>
                                                    </Ellipse.Fill>
                                                </Ellipse>
                                                <TextBlock Text="{Binding Title}" TextWrapping="Wrap" Margin="10,0,0,10"
                                                           Foreground="{Binding Source={StaticResource Theme}, Path=cuTheme.SecondTextBrush}"  
														   VerticalAlignment="Center" FontSize="22"/>
                                            </StackPanel>
                                        </DataTemplate>
                                    </delay:FoodTemplateSelector.Tail>
                                    <delay:FoodTemplateSelector.Title>
                                        <DataTemplate>
                                            <StackPanel Margin="0"  Width="468" Background="#92dfff">
                                            	<TextBlock Text="{Binding Content}"  Margin="10,0" 
                                            		Foreground="White"  FontSize="22"/>
                                            </StackPanel>
                                        </DataTemplate>
                                    </delay:FoodTemplateSelector.Title>
                                    <delay:FoodTemplateSelector.LastTitle>
                                        <DataTemplate>
                                            <StackPanel Margin="0,0,0,0" Width="460" Orientation="Horizontal" HorizontalAlignment="Center" Background="DarkGray">
                                            	
                                                <TextBlock Text="{Binding Title}" TextWrapping="Wrap" Margin="10,5,5,5"
                                                           Foreground="White" FontSize="22"/>
														   
                                            </StackPanel>
                                        </DataTemplate>
                                    </delay:FoodTemplateSelector.LastTitle>
                                </delay:FoodTemplateSelector>
                            </DataTemplate>
                        </ListBox.ItemTemplate>
                    </ListBox>
                </Grid>
            </controls:PivotItem>
 			<!--透视项目二-->
            <controls:PivotItem  x:Name="pivotReply"  DataContext="phoneInfoReply" Margin="12,0,0,0">
				<controls:PivotItem.Header>
				 <StackPanel Orientation="Horizontal" >
                        <TextBlock Text="评论" Foreground="{Binding Source={StaticResource Theme}, Path=cuTheme.TitleBrush}"  FontSize="50"  VerticalAlignment="Center"/>
                        <Image Margin="10,10,0,0"  Width="25" Height="25" Source="/Icon/info/a_article.png"/>
                        <TextBlock  x:Name="replyCount" Margin="10,0,0,0"  FontSize="18" Foreground="#b5b5b5" VerticalAlignment="Center"/>
                 </StackPanel>
				 </controls:PivotItem.Header>
				 <Grid>
                    <ListBox x:Name="MoreListBox"  Loaded="FirstListBox_Loaded" Tap="FirstListBox_Tap" ItemsSource="{Binding PoneConterItems}">
                        <ListBox.ItemsPanel>
                            <ItemsPanelTemplate>
                                <StackPanel></StackPanel>
                            </ItemsPanelTemplate>
                        </ListBox.ItemsPanel>
                        <ListBox.ItemTemplate>
                            <DataTemplate>
                                <delay:FoodTemplateSelector x:Name="foodTemplateSelector" Content="{Binding}" RenderTransformOrigin="0.5,0.5">
                                    <delay:FoodTemplateSelector.RenderTransform>
                                        <CompositeTransform/>
                                    </delay:FoodTemplateSelector.RenderTransform>
                                    <delay:FoodTemplateSelector.Main>
                                        <DataTemplate>
                                            <StackPanel Margin="0,0,0,15">
                                                <StackPanel Margin="0,0,15,0" Orientation="Horizontal" >
                                                    <TextBlock Text="{Binding Title}"  Margin="5,0,0,0" Width="310" TextWrapping="NoWrap" Style="{StaticResource PhoneTextExtraLargeStyle}" Foreground="#FF0068B7" FontSize="24" VerticalAlignment="Bottom"/>
                                                    <TextBlock Text="{Binding Replytime}"  Margin="5,0,0,0" Width="70" TextWrapping="NoWrap" Style="{StaticResource PhoneTextExtraLargeStyle}" Foreground="#FFA0A0A0" FontSize="16" VerticalAlignment="Bottom"/>
                                                    <TextBlock Text="{Binding Keywords}"  Margin="5,0,0,0" Width="60" TextWrapping="NoWrap" Style="{StaticResource PhoneTextExtraLargeStyle}"     Foreground="#FFA0A0A0" FontSize="16" VerticalAlignment="Bottom"/>
                                                </StackPanel>
                                                <Path Margin="20,0,0,-1"
                                                      Stroke="{Binding Source={StaticResource Theme}, Path=cuTheme.lexunReplyBackBrush}"                                                        
                                                      Fill="{Binding Source={StaticResource Theme}, Path=cuTheme.lexunReplyBackBrush}"                                                         
                                                      Data="M10,10 L0,10 L5,0 z" VerticalAlignment="Bottom" HorizontalAlignment="Left" />
                                                <Border  Margin="0,0,10,0" BorderBrush="#FFFFFFFF" 
                                                         Background="#cee8ff" 
                                                         BorderThickness="0" CornerRadius="5,5,5,5">
                                                    <TextBlock Text="{Binding Content}"  Margin="25,10,5,10" 
                                                               Foreground="{Binding Source={StaticResource Theme}, Path=cuTheme.lexunTBForgetBrush}" 
												               TextWrapping="Wrap" Style="{StaticResource PhoneTextExtraLargeStyle}" 
												               FontSize="20"/>
                                                </Border>
                                            </StackPanel>
                                        </DataTemplate>
                                    </delay:FoodTemplateSelector.Main>
                                    <delay:FoodTemplateSelector.LastTitle>
                                        <DataTemplate>
                                            <StackPanel Margin="0,0,15,0" Grid.Column="0" Width="460" HorizontalAlignment="Center"  Background="DarkGray">
                                                <TextBlock Text="{Binding Title}" TextWrapping="Wrap" Style="{StaticResource PhoneTextExtraLargeStyle}" Margin="0"
                                                           FontSize="24" Foreground="#ffffff"  />
                                            </StackPanel>
                                        </DataTemplate>
                                    </delay:FoodTemplateSelector.LastTitle>
                                </delay:FoodTemplateSelector>
                            </DataTemplate>
                        </ListBox.ItemTemplate>
                    </ListBox>
                    <TextBlock x:Name="titleText" 
                           Foreground="{Binding Source={StaticResource Theme}, Path=cuTheme.SecondTextBrush}" 
				           HorizontalAlignment="Left" TextWrapping="Wrap" Text="暂无评论，欢迎您发表评论"
				           FontSize="20" VerticalAlignment="Top" Margin="98,193,0,0" Visibility="Collapsed" />
				</Grid>
            </controls:PivotItem>
		</controls:Pivot>
       
        <Popup x:Name="FullModePopup">
            <Grid Background="Black" Height="800" Width="480"  Tap="Grid_Tap_1">
                <Grid HorizontalAlignment="Center" VerticalAlignment="Center" Tap="Grid_Tap" Margin="0,0,0,100">
                    <Image  x:Name="popImage" Stretch="None" />
                </Grid>
            </Grid>
        </Popup>
    </Grid>
    <phone:PhoneApplicationPage.ApplicationBar>
        <shell:ApplicationBar  BackgroundColor="#ff31b2e7" ForegroundColor="#ffffffff">
            <shell:ApplicationBarIconButton IconUri="Icon/info/i_forum.png" Text="发表评论" Click="Reply"/>
            <shell:ApplicationBarIconButton IconUri="Icon/info/i_refresh.png" Text="刷新" Click="refresh" />
        </shell:ApplicationBar>
    </phone:PhoneApplicationPage.ApplicationBar>
    
</phone:PhoneApplicationPage>